home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / lib / c / exec / RCS / execle.c,v < prev    next >
Encoding:
Text File  |  1988-07-29  |  3.1 KB  |  171 lines

  1. head     1.4;
  2. access   ;
  3. symbols  ;
  4. locks    ; strict;
  5. comment  @ * @;
  6.  
  7.  
  8. 1.4
  9. date     88.07.28.17.41.50;  author ouster;  state Exp;
  10. branches ;
  11. next     1.3;
  12.  
  13. 1.3
  14. date     88.07.25.10.49.53;  author ouster;  state Exp;
  15. branches ;
  16. next     1.2;
  17.  
  18. 1.2
  19. date     88.07.11.15.40.41;  author ouster;  state Exp;
  20. branches ;
  21. next     1.1;
  22.  
  23. 1.1
  24. date     88.06.19.16.55.58;  author ouster;  state Exp;
  25. branches ;
  26. next     ;
  27.  
  28.  
  29. desc
  30. @@
  31.  
  32.  
  33. 1.4
  34. log
  35. @Add #ifdefs to generate correct lint library.
  36. @
  37. text
  38. @/* 
  39.  * execle.c --
  40.  *
  41.  *    Source code for the execle library procedure.
  42.  *
  43.  * Copyright 1988 Regents of the University of California
  44.  * Permission to use, copy, modify, and distribute this
  45.  * software and its documentation for any purpose and without
  46.  * fee is hereby granted, provided that the above copyright
  47.  * notice appear in all copies.  The University of California
  48.  * makes no representations about the suitability of this
  49.  * software for any purpose.  It is provided "as is" without
  50.  * express or implied warranty.
  51.  */
  52.  
  53. #ifndef lint
  54. static char rcsid[] = "$Header: execle.c,v 1.3 88/07/25 10:49:53 ouster Exp $ SPRITE (Berkeley)";
  55. #endif not lint
  56.  
  57. #include <stdlib.h>
  58. #include <varargs.h>
  59.  
  60. /*
  61.  * Library imports:
  62.  */
  63.  
  64. extern execve();
  65. extern char **_ExecArgs();
  66.  
  67.  
  68. /*
  69.  *----------------------------------------------------------------------
  70.  *
  71.  * execle --
  72.  *
  73.  *    Execute a process, using an explicitly-supplied environment, and
  74.  *    with arguments in-line (as individual parameters) instead of in
  75.  *    a separate array.
  76.  *
  77.  * Results:
  78.  *    This procedure returns only if the exec fails.  In this case
  79.  *    the return value is -1.
  80.  *
  81.  * Side effects:
  82.  *    Overlays the current process with a new image.  See the man
  83.  *    page for details.
  84.  *
  85.  *----------------------------------------------------------------------
  86.  */
  87.  
  88. #ifndef lint
  89. int
  90. execle(va_alist)
  91.     va_dcl            /* Name of file containing program to exec,
  92.                  * followed by one or more arguments of type
  93.                  * "char *", terminated by a zero argument,
  94.                  * followed by a "char **" environment
  95.                  * pointer. */
  96. {
  97.     char *name;
  98.     char **argv;
  99.     va_list args;
  100.  
  101.     va_start(args);
  102.     name = va_arg(args, char *);
  103.     argv = _ExecArgs(&args);
  104.     execve(name, argv, va_arg(args, char **));
  105.     free((char *) argv);
  106.     return -1;
  107. }
  108. #else
  109. /* VARARGS2 */
  110. /* ARGSUSED */
  111. int
  112. execl(file, arg1)
  113.     char *file;
  114.     char *arg1;
  115. {
  116.     return 0;
  117. }
  118. #endif
  119. @
  120.  
  121.  
  122. 1.3
  123. log
  124. @Lint.
  125. @
  126. text
  127. @d17 1
  128. a17 1
  129. static char rcsid[] = "$Header: execle.c,v 1.2 88/07/11 15:40:41 ouster Exp $ SPRITE (Berkeley)";
  130. d51 1
  131. a51 1
  132.     /* VARARGS0 */
  133. d71 11
  134. @
  135.  
  136.  
  137. 1.2
  138. log
  139. @When using varargs, only have a single argument in the list.
  140. @
  141. text
  142. @d17 1
  143. a17 1
  144. static char rcsid[] = "$Header: execle.c,v 1.1 88/06/19 16:55:58 ouster Exp $ SPRITE (Berkeley)";
  145. d20 1
  146. d34 1
  147. a34 1
  148.  * execl --
  149. @
  150.  
  151.  
  152. 1.1
  153. log
  154. @Initial revision
  155. @
  156. text
  157. @d17 1
  158. a17 1
  159. static char rcsid[] = "$Header: proto.c,v 1.2 88/03/11 08:39:08 ouster Exp $ SPRITE (Berkeley)";
  160. d50 1
  161. d52 6
  162. a57 5
  163. execle(name, va_alist)
  164.     char *name;            /* Name of file containing program to exec. */
  165.     va_dcl            /* One or more arguments of type "char *",
  166.                  * terminated by a zero argument.  After this
  167.                  * is a "char **" environment pointer. */
  168. d59 1
  169. d64 1
  170. @
  171.